public class Exer03 
{
	public static void main(String[] args)
	{
		double a, b, c, k , x1, x2;
		a = 1.0;
		b = 2.0;
		c = -8.0;
		k = b*b - 4*a*c;

		if (k<0)
		{
			 System.out.println("方程无解。");
		}
		else if (k == 0)
		{
			 x1  = -b / (2*a);
			 System.out.println("方程有两相同解，是：");
			 System.out.println("x1 = x2 =" + x1);
		}
		else 
		{
			x1 = (-b + Math.sqrt(k))/2*a;
			x2 = (-b - Math.sqrt(k))/2*a;
			System.out.println("方程有两不同解，分别是：");
			System.out.println("x1 = " + x1 + "  x2 =" + x2);
		}
		
	}
}
